package Code.Day10_20241011.com.dx.day10;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
 * @ClassName Test03
 * @Description 包装类
 * @Author 12994
 * @Date 2024/10/11 11:32
 * @Version 1.0
 **/
public class Test03 {
    public static void main(String[] args) {
        // 包装类与基本数据类型之间可以自动转换
        int a = 0;
        Integer b = Integer.valueOf(a + 1);
        int c = b + 1;

        Boolean b1 = Boolean.valueOf("TRUE");

        // Character的valueOf方法仅接受字符串输入, 并没有重载
        Character c1 = Character.valueOf('1');


        Random random = new Random(1234);
        for (int i = 0; i < 10; i++) {
            System.out.println(random.nextInt(10, 32));
        }
        System.out.println(Math.max(6.6, 7.7));

        // Random的多线程版本
        // current使用当前设备的熵生成随机数, 不支持设置随机种子
        ThreadLocalRandom ran = ThreadLocalRandom.current();
        for (int i = 0; i < 10; i++) {
            System.out.println(ran.nextDouble(10.0, 32.0));
        }
    }
}
